<template>
  <div class="top">
    <div class="left">
      <svg-icon name="icon-arrow" class="arrow-back"></svg-icon>
      New Email Campaign
    </div>
    <div class="right">
      <a-button type="primary">Publish</a-button>
    </div>
  </div>
  <div class="wrap">
    <div class="left">
      <div class="box" style="margin-top: 0; padding-bottom: 0;">
        <a-form
          layout="vertical"
          autocomplete="off"
          class="form1"
        >
          <a-form-item
            label="Name"
            name="name"
          >
            <a-input />
          </a-form-item>
          <a-form-item
            label="Description"
            name="description"
          >
            <a-input />
          </a-form-item>
        </a-form>
      </div>
      <div class="box">
        <div class="title">Select Segments/List</div>
        <a-radio-group v-model:value="segType" style="margin-bottom:10px">
          <a-radio value="segments">Segments</a-radio>
          <a-radio value="lists">Lists</a-radio>
        </a-radio-group>
        <a-select
          ref="select"
          v-model:value="segments"
          style="width: 100%"
          placeholder="Select segments"
        >
          <a-select-option value="jack">Jack</a-select-option>
          <a-select-option value="rose">Rose</a-select-option>
        </a-select>  
        <div class="tips">
          Want to create new segments? <a href="">Go to the Contacts page</a>
        </div>
      </div>
      <div class="box">
        <div class="title">Contents</div>
        <a-upload
          list-type="picture-card"
          :show-upload-list="false"
          class="upload"
        >
          <plus-outlined></plus-outlined> 
          <div class="ant-upload-text">Create New</div>
        </a-upload>
      </div>  
      <div class="box">
        <div class="title">Campaign Information</div>
        <a-form
          layout="vertical"
          autocomplete="off"
        >
          <a-form-item
            label="Subject"
          >
            <a-input />
          </a-form-item>
          <a-form-item
            label="From Name"
          >
            <a-input />
          </a-form-item>
          <a-form-item
            label="From and reply to address"
          >
            <a-input />
          </a-form-item>
        </a-form>
      </div>  
      <div class="box">
        <div class="title">Physical Address</div>
        <a-form
          layout="vertical"
          autocomplete="off"
        >
          <a-form-item
            label="Organization Name"
          >
            <a-input />
          </a-form-item>
          <a-form-item
            label="Address"
          >
            <a-row :gutter="[{ xs: 0, sm: 0, md: 16, lg: 16 }, 16]">
              <a-col :span="24"><a-input placeholder="Street Address" /></a-col>
              <a-col :span="24" :lg="12"><a-input placeholder="Apartment, Suite, etc." /></a-col>
              <a-col :span="24" :lg="12"><a-input placeholder="City" /></a-col>
              <a-col :span="24" :lg="8"><a-input placeholder="Select a State" /></a-col>
              <a-col :span="24" :lg="8"><a-input placeholder="Select a Country" /></a-col>
              <a-col :span="24" :lg="8"><a-input placeholder="ZIP/Postal Code" /></a-col>
            </a-row>
            
          </a-form-item>
        </a-form>
      </div>  
      <div class="box">
        <div class="title">Schedule</div>
        <a-radio-group class="schedule-group" v-model:value="scheduleType">
          <a-radio value="specific" style="border-bottom: 1px solid #e0e0e0;">
            <div class="radio-field">
              <div>Specific Time</div>
              <a-date-picker show-time class="date-picker" />
            </div>
            <div class="radio-settings">
              <a-checkbox>Multi-wave Campaign</a-checkbox>
              <a-button type="primary" ghost>Settings</a-button>
            </div>
          </a-radio>
          <a-radio value="week">
            <div class="radio-field">
              <div>Every Week on</div>
              <a-date-picker picker="week" class="date-picker"/>
            </div>
          </a-radio>
          <a-radio value="month">
            <div class="radio-field">
              <div>Every Month on</div>
              <a-date-picker picker="month" class="date-picker"/>
            </div>
          </a-radio>
        </a-radio-group>
      </div>  
    </div>
    <div class="right">
      <div class="box">
        <div class="title">Performance</div>
        <a-row>
          <a-col :span="8">
            <a-statistic title="Email Sent" :value="621" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Opened" :value="212" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Open Rate" value="34.19%" />
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="8">
            <a-statistic title="Clicked" :value="34" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Click Rate" value="21.2%" />
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="8">
            <a-statistic title="Ubsbuscribed" :value="34" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Ubsbuscribed Rate" value="0.00%" />
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="8">
            <a-statistic title="Abuse Report" :value="34" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Abuse Rate" value="21.2%" />
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="8">
            <a-statistic title="Bouced" :value="1" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Soft Bouced" :value="2" />
          </a-col>
          <a-col :span="8">
            <a-statistic title="Hard Bouced" :value="3" />
          </a-col>
        </a-row>
      </div>  
      <div class="box">
        <div class="title">Remaining Email Sends</div>
        <div>999 remaining.</div>
        <a-progress :percent="30" size="small" :show-info="false" />
        <div class="sends-info">
          <div>1/1000 sent</div>
          <div><a-button type="primary" ghost>Upgrade</a-button></div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { defineComponent, reactive, toRefs } from 'vue'
import { PlusOutlined } from '@ant-design/icons-vue'

export default defineComponent({
  components: {
    PlusOutlined
  },
  setup() {
    const state = reactive({
      segments: null,
      segType: 'segments',
      scheduleType: 'specific',
    })
    return toRefs(state)
  },
})
</script>

<style lang="scss" scoped>
.top {
  margin-top: -20px;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .left{
    font-size: 20px;
    font-weight: bold;
    .arrow-back {
      font-weight: bold;
      font-size: 24px;
      vertical-align: middle;
      color: #369EEE;
    }
  }
}
.wrap{
  display: flex;
  .left{
    flex:1;
  }
  .right{
    width: 360px;
    margin-left: 20px;
  }
  .box {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
    overflow:hidden;
    .title{
      font-size: 16px;
      font-weight: bold;
      margin: 0 0 16px 0;
    }
  }
  .sends-info{
    text-align: right;
  }
  .form1{
    :deep{
      .ant-form-item-label > label{
        font-size: 16px;
        font-weight: bold;

      }
    }
  }
  
  .tips {
    color: #999;
    margin-top: 10px;
  }
  .upload {
    :deep(.ant-upload){
      width: 200px;
      height: 136px;
    }
  }
  .schedule-group {
    :deep(.ant-radio-wrapper){
      width: 100%;
      margin-top: 16px;
      padding-bottom: 10px;
      
      > span {
        display: block;
        &:not(.ant-radio){
          flex:1
        }
      }
    }
  }
  .radio-field {
    display: flex;
    justify-content: space-between;
    .date-picker{
      width: 300px;
    }
  }
  .radio-settings {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
  }
}
@media (max-width: 768px) {
  .wrap {
    display: unset;
    .right{
      width: unset;
      margin: 0;
    }
    .upload {
      :deep(.ant-upload){
        width: 100%;

      }
    }
    .radio-field {
      display: unset;
      .date-picker{
        width: 100%;
        margin-top: 10px;
      }
    }
  }
  
}
</style>